/*
一些常用工具*/

import { ElLoading,ElMessage  } from "element-plus";
let loadingInstance = {}; //ElLoading.service({}); //页面加载层

const util = {
  gotoWin(url:string, type:number) {
    if (type === 2) {
      window.open(url);
    } else {
      location.href = url;
    }
  },
  //页面加载提示层
  htmlLoad(msg ?: string) {
    let options = {
      lock: true,
      text: msg,
      spinner: "el-icon-loading",
      background: "rgba(0, 0, 0, 0.7)",
      customClass: "load-style"
    };
    loadingInstance = ElLoading.service(options);
  },
  //关闭页面加载层
  htmlCloseLoad() {
    (loadingInstance as any).close();
  },
  showMessage(msg:string, type:any){
    ElMessage({
      message:msg,
      type:type,
    })
  }
}
export default util;
